package com.feiyue.hikari.utils;

import lombok.Data;

/**
 * Created with IntelliJ IDEA.
 * Author: 86185
 * Date: 2019/9/13
 * Time: 22:12
 * Description: No Description
 */
@Data
public class ResponInfo <T>{

    private int code;
    private String msg;
    private  T data;

    public ResponInfo() {
    }

    public ResponInfo(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    public static <T> ResponInfo makeSuc(T data){
        ResponInfo responInfo = new ResponInfo();
        responInfo.setCode(1);
        responInfo.setMsg("请求成功");
        responInfo.setData(data);
        return responInfo;
    }
    public static <T> ResponInfo makeFail(String msg){
        ResponInfo responInfo = new ResponInfo();
        responInfo.setCode(0);
        responInfo.setMsg("请求失败");
        if (null != msg){
            responInfo.setMsg(msg);
        }
        return responInfo;
    }

}
